package entity;

import java.io.Serializable;

public class TUser implements Serializable {
    private String userId;
    private String userName;
    private String password;
    private String mail;
    private Integer auth;
    private String authString;
    private static final String AUTH_USER = "一般ユーザ";
    private static final String AUTH_ADMIN = "管理者";

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public Integer getAuth() {
        return auth;
    }

    public void setAuth(Integer auth) {
        this.auth = auth;
        // TODO 他に権限の数値を文字列で置き換える方法があるか
        if (auth == 1) {
            setAuthString(AUTH_ADMIN);
        }
        else {
            setAuthString(AUTH_USER);
        }
    }

    public String getAuthString() {
        return authString;
    }

    public void setAuthString(String authString) {
        this.authString = authString;
    }
}
